import React from 'react';
import ReactDOM from 'react-dom';
import {observable,action} from 'mobx'
import CountApp from './CountApp';

// observable定义了一个可观察对象
let obj=observable({
     name:"张三",
     count:0
})

// action定义了一个动作函数
obj.resetCount=action(()=>{
    obj.count=0
})
setInterval(function(){
    obj.count++
},1000)

setTimeout(function(){
    obj.name="李四"
},3000)

// 将可观察对象传递给组件
ReactDOM.render(<CountApp obj={obj}/>, document.getElementById('root'));


